#include <iostream>
#include <fstream>
#include <ctime>
#include <vector>
using namespace std;
vector <int> sort (vector <int> arr){
  int k = 0;
  for (int i = 0; i < arr.size(); i++){
    for (int j = 0; j < arr.size() - 1 - i; j++){
      if (arr[j] > arr[j + 1]){
        int t = arr[j];
        arr[j] = arr[j + 1];
        arr[j + 1] = t;
        k++;
      }
    }
    if(k == 0){
      break;
    }
  }
  return arr;
}
int main() {
  ifstream f1;
  f1.open("m1_sorted.txt");
  vector <int> arr;
  int x;
  while(f1 >> x){
    arr.push_back(x);
  }
  double start_time = clock();
  arr = sort(arr);
  double finish_time = clock();
  cout << "m1_sorted " << (finish_time - start_time) / 1000 << " millisecounds"<<endl;
  ifstream f2;
  f2.open("m2_reverse.txt");
  vector <int> arr1;
  int x2;
  while(f2>> x2){
    arr1.push_back(x2);
  }
  double start_time2 = clock();
  arr1 = sort(arr1);
  double finish_time2 = clock();
  cout << "m1_reversed " << (finish_time2- start_time2) / 1000 << " millisecounds"<<endl;
  ifstream f3;
  f3.open("m1_shuffle.txt");
  vector <int> arr2;
  int x3;
  while(f3 >> x3){
    arr2.push_back(x3);
  }
  double start_time3 = clock();
  arr2 = sort(arr2);
  double finish_time3 = clock();
  cout << "m1_shuffled " << (finish_time3 - start_time3) / 1000 << " millisecounds"<<endl;
}